<?php
/*
Primary Author: Derek Shue
Secondary: Alex Arey
Documentation: Cheng Yi
Updated: 12/10/2011
Module Description: The Teachers module adds/finds/updates/deletes Teachers from the database.
*/
class Application_Model_DbTable_Teachers extends Zend_Db_Table_Abstract
{

    protected $_name = 'TEACHERS';


public function getTeacher($where)
    {

        $row = $this->fetchRow($where);
        if (!$row) {
            throw new Exception("Could not find row $where");
        }
        return $row->toArray();
    }

    public function addTeacher($id,$firstname, $lastname, $department, $officelocation, $email)
    {
        $data = array(
            'ID' => $id,
            'FIRSTNAME' => $firstname,
			'LASTNAME' => $lastname,
			'DEPARTMENT' => $department,
			'OFFICELOCATION' => $officelocation,
			'EMAIL' => $email

        );
        $this->insert($data);
    }

    public function updateTeacher($id, $firstname, $lastname, $department, $officelocation, $email)
    {
        $data = array(
            'ID' => $id,
            'FIRSTNAME' => $firstname,
			'LASTNAME' => $lastname,
			'DEPARTMENT' => $department,
			'OFFICELOCATION' => $officelocation,
        	'EMAIL' => $email

        );
		$data = array_filter($data);
        $this->update($data, 'ID = '. (int)$id);
    }

    public function deleteTeacher($where)
    {
        $this->delete($where);
    }



/*
IDNUMBER
FIRSTNAMEVARCHAR2
LASTNAMEVARCHAR2
DEPARTMENTVARCHAR2
OFFICELOCATIONVARCHAR2
*/


}









































































































































